package com.tjetc;

import com.tjetc.component.TestUserDao;
import com.tjetc.component.UserController;
import com.tjetc.component.UserDao;
import com.tjetc.component.UserService;
import com.tjetc.config.AppConfig;

/**
 * @author gaoyongxiang
 * @version v1.0
 * @date 2025/9/3
 */
public class TestMyIOC {
    public static void main(String[] args) {
        MyAnnotationConfigApplicationContext ioc = new MyAnnotationConfigApplicationContext(AppConfig.class);
//        System.out.println(ioc);

//        UserService userService = (UserService) ioc.getBean("userService");
//        UserService userService1 = (UserService) ioc.getBean("userService");
//
//        System.out.println(userService == userService1);
//
//        UserController userController = (UserController) ioc.getBean("userController");
//        UserController userController1 = (UserController) ioc.getBean("userController");
//        System.out.println(userController == userController1);

//        Object bean = ioc.getBean("11");
//        System.out.println(bean);
//        userController.f();


//        UserController userController3 = (UserController) ioc.getBean("userController");

        UserDao userDao = (UserDao) ioc.getBean("userDaoImpl");
        System.out.println("userDao.getClass() = " + userDao.getClass());
        int f = userDao.f();
        System.out.println(f);
        userDao.f1();


        TestUserDao testUserDaoImpl = (TestUserDao) ioc.getBean("testUserDaoImpl");
        System.out.println("testUserDaoImpl.getClass() = " + testUserDaoImpl.getClass());
        testUserDaoImpl.f();

    }



}